/*
 * Copyright 2020-2021 redragon.dongbin
 *
 * This file is part of redragon-erp/赤龙ERP.

 * redragon-erp/赤龙ERP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.

 * redragon-erp/赤龙ERP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with redragon-erp/赤龙ERP.  If not, see <https://www.gnu.org/licenses/>.
 */
package com.erp.order.po.dao.model;

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.erp.masterdata.common.model.BaseModel;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
@Data
@MappedSuperclass
public class PoHeadBase extends BaseModel {

    //Constructors
    public PoHeadBase() {
    }
    
    //Fields
    
    //采购订单头id
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "po_head_id", unique = true, nullable = false)
    private Integer poHeadId;

    //采购订单头编码
    @NotBlank(message="{code.NotBlank}")
    @Column(name = "po_head_code", unique = true, nullable = false, length = 45)
    private String poHeadCode;

    //采购订单类型
    @NotBlank(message="采购订单类型不能为空")
    @Column(name = "po_type", unique = false, nullable = false, length = 45)
    private String poType;

    //采购订单名称
    @NotBlank(message="{name.NotBlank}")
    @Column(name = "po_name", unique = true, nullable = false, length = 45)
    private String poName;

    //采购协议头编码
    @Column(name = "po_agreement_head_code", unique = false, nullable = true, length = 45)
    private String poAgreementHeadCode;

    //采购订单描述
    @Column(name = "po_desc", unique = false, nullable = true, length = 500)
    private String poDesc;

    //项目编码
    @Column(name = "project_code", unique = false, nullable = true, length = 45)
    private String projectCode;

    //供应商编码
    @NotBlank(message="供应商不能为空")
    @Column(name = "vendor_code", unique = false, nullable = false, length = 45)
    private String vendorCode;

    //采购订单币种
    @NotBlank(message="币种不能为空")
    @Column(name = "currency_code", unique = false, nullable = false, length = 45)
    private String currencyCode;

    //采购订单预付款金额
    @Column(name = "prepay_amount", unique = false, nullable = false)
    private BigDecimal prepayAmount;

    //采购订单开始日期
    @Column(name = "start_date", unique = false, nullable = true)
    private Date startDate;

    //采购订单结束日期
    @Column(name = "end_date", unique = false, nullable = true)
    private Date endDate;

    //采购订单签订日期
    @NotNull(message="签订日期不能为空")
    @Column(name = "sign_date", unique = false, nullable = false)
    private Date signDate;

    //计税类型
    @Column(name = "tax_type", unique = false, nullable = false, length = 45)
    private String taxType;

    //计税比率
    @Column(name = "tax_percent", unique = false, nullable = false)
    private BigDecimal taxPercent;

    //版本
    @Column(name = "version", unique = false, nullable = false)
    private Integer version;

    //状态（新建NEW，确认CONFIRM，变更ALTER，取消CANCEL）
    @NotBlank(message="状态不能为空")
    @Column(name = "status", unique = false, nullable = false, length = 10)
    private String status;

    //接收状态（未入库N，已入库Y，部分入库PART）
    @NotBlank(message="接收状态不能为空")
    @Column(name = "receive_status", unique = false, nullable = false, length = 10)
    private String receiveStatus;

    //付款状态（未付款N，已付款Y，部分付款PART）
    @NotBlank(message="付款状态不能为空")
    @Column(name = "payment_status", unique = false, nullable = false, length = 10)
    private String paymentStatus;

    //审批状态（未提交UNSUBMIT、已提交SUBMIT、已审批APPROVE、已驳回REJECT）
    @Column(name = "approve_status", unique = false, nullable = false, length = 45)
    private String approveStatus;

    //采购员
    @Column(name = "staff_code", unique = false, nullable = false, length = 45)
    private String staffCode;

    //采购部门
    @Column(name = "department_code", unique = false, nullable = false, length = 45)
    private String departmentCode;

    //组织机构
    @Column(name = "org_code", unique = false, nullable = false, length = 10)
    private String orgCode;

    @Column(name = "attribute1", unique = false, nullable = true, length = 45)
    private String attribute1;

    @Column(name = "attribute2", unique = false, nullable = true, length = 45)
    private String attribute2;

    @Column(name = "attribute3", unique = false, nullable = true, length = 45)
    private String attribute3;

    @Column(name = "attribute4", unique = false, nullable = true, length = 45)
    private String attribute4;

    @Column(name = "attribute5", unique = false, nullable = true, length = 45)
    private String attribute5;

    @Column(name = "attribute6", unique = false, nullable = true, length = 45)
    private String attribute6;

    @Column(name = "attribute7", unique = false, nullable = true, length = 45)
    private String attribute7;

    @Column(name = "attribute8", unique = false, nullable = true, length = 45)
    private String attribute8;

    @Column(name = "attribute9", unique = false, nullable = true, length = 45)
    private String attribute9;

    @Column(name = "attribute10", unique = false, nullable = true, length = 45)
    private String attribute10;


    
    /*
     * 用于展示的字段
     */
    @Transient
    private String staffName;
    @Transient
    private String departmentName;
    @Transient
    private BigDecimal amount;
    @Transient
    private String vendorContactDesc;
    @Transient
    private String poAgreementHeadName;
    @Transient
    private BigDecimal poaAmount;
    @Transient
    private BigDecimal poaFinishAmount;
    

}